﻿using MN.Framework.Common;
using MN.Framework.Common.Security;
using MN.Framework.MetaData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MN.Framework.Common.Security
{
    [EntityHeader("نقش کاربران")]
    [AssociatedWith(typeof(Role), "RoleID", MN.Framework.MetaData.AssociationType.OneToMany)]
    [AssociatedWith(typeof(User), "UserID", MN.Framework.MetaData.AssociationType.OneToMany)]
    public class UsersInRole : BaseEntity,IUsersInRole
    {
        public override int ID { get; set; }
        public int RoleID { get; set; }
        public int UserID { get; set; }

        public virtual Role Role { get; set; }
        public virtual User User { get; set; }

        public override void GetColumns(List<ColumnInfo> columns)
        {
            columns.Add(new NumericColumnInfo("ID", "شناسه", true));
            columns.Add(new ReferenceColumnInfo("UserID", "کاربر"));
            columns.Add(new ReferenceColumnInfo("RoleID", "نقش"));
        }
    }
}
